mobtalkerfandomcom-20200215-history
How to Make a Script
If you are here, it means that you want to make your own script, or you are just curious to know how to make one - well, this page may help you! This page is a tutorial for making your own script for the mod, which will be attempted kept updated, as well as made easy to use and helpful. If you read it all and still have problems when testing, please post: * What is happening when you try to use it * Where you have saved the script * The bug report (download link for the bug report, please) Someone else will then attempt to help solve the problem. In case the problem is within the script code, please include a download link to your script as well to make it easier to identify the problem. The admins User:TheAbner and User:ServantOfTheThirdEye stand available to help if need be. Simply message one of them, and they will get back to you as soon as they can. We hope you all write good scripts and post them in the Custom Scripts article so that people can try it out. Making a Script Step 1 # Create a folder named mobTalker_script. # Create a folder inside mobTalker_script, named after the mob you're making a script for. (Referred to as Name) OBS: While in most cases the names are simply "Enderman", "Creeper", etc, if you are writing a script for any of the below mobs, the folder name should be as follows: #* Magma Cube = LavaSlime #* Iron Golem = VillagerGolem #* Snow Golem = SnowMan # Open Notepad (Windows) or TextEdit (Mac), create an empty text file, and save it with UTF-8 character encoding. #* Win: Go to 'Save As'. Under 'Encoding' choose 'UTF-8'. #* Mac: Click 'Format' in the menubar, and choose 'Make Plain Text'. Go to "Save As". Under "Plain Text Encoding" choose 'UTF-8'. # Save the file in Name, and name it Normal. mobTalker_script/Name/Normal.txt # On the first line, write the code: #SET_NAME # After that, on the same line, write the name of your mob in your script. Ex: "Andr" or "Cupa". This will be the display name of your mob when you talk to it. # On the next line, write the first thing the mob will say. Ex: "..." # On the next line, write the code: #END. #* This code tells Minecraft to stop reading the script, as it's the end of it. # Your code now looks as follows: #SET_NAME Andr ... #END Now, run a test to see if you've done everything right this far: # Change the file extension of Normal.txt to Normal.script #* Win: If you can't see the file extension in the folder, go to 'Organize > Folder and Search Options', then click the 'View' tab. Uncheck the box titled 'Hide extensions for known file types'. Now you can change the file extension by renaming the file. #* Mac: Highlight the file and hit Cmd-i (Command/Apple-key left of the spacebar). Change the file extension under 'Name & Extension', and press Enter, then 'Use .script' in the pop-up warning. # Install your script like any other script, following the installation guide. # Run Minecraft. # Talk to the mob your script is made for. If the mob replies with "..." every time you talk to it, then you have successfully completed Step 1 of this guide. Step 2 # Rename Normal.script back to Normal.txt so you can edit it again. # Add the code #MAKESHADOW on a new line above #END. #SET_NAME Andr ... #MAKESHADOW #END # Create a folder inside mobTalker_script, named Friendly. # Create a folder inside Friendly, named after the mob you're making a script for. (Referred to as Days) # Create a folder inside Days, named day1. # Create a new UTF-8 text file inside day1, and name it love0. mobTalker_script/Friendly/Days/day1/love0.txt #* The "Love Level" can be increased or decreased with the #INCREASE_LOVE or #DECREASE_LOVE commands. Depending on the value of the level, the mod reads 'love#.script', with ' #' being the current love level. Ex: If the love level is at '25', then the mod will read 'love25.script' next time you talk to the mob. Like this, you can have different stories in a single script. Ex: If the player chooses Option 1 the love will decrease by 5, and the love#.script file that it will then run, will make the mob attack the player. However Option 2 will increase the love and the love#.script file that it will run, will be a lovely ending, etc. # Pay close attention now. This is where the real coding starts. Type in the following code: #FETCH_NAME #SET_NAME Andr Hi... #SET_NAME Andr Who are you? #SET_NAME (playername) I'm (playername)::Nice to meet you! #SET_NAME What do you want with me... I'm an Enderman , shouldn't you be scared of me... or try to attack me, or avoid looking me in the eyes????? #SET_NAME (playername) You don't look dangerous #SET_POS Middle #SET_NAME Narrator *She was very shy and that's why she acted like that* #SET_POS Left #SET_NAME Andr Don't I... #INCREASE_LOVE 5 #FINISH_DAY #END Having trouble understanding what you just copy-pasted? Don't worry, that's normal. Let us take a closer look at it, piece at a time. These are some of the basic commands. For a full list of available commands, as well as their usage, read the article; Script Commands. We previously mentioned a file - or actually, several files - called default.script. These are the files which the mod will read under several circumstances: * When #FINISH_DAY is executed * Once the Script is over. * If it can't find the file it's looking for. Which makes all of them very important. Also important to note is that each day# folder needs to have it's own default.script file. Without these files, the script won't function correctly, so you'll need to get those in place before you can run another test of the script. # Create a new UTF-8 text file inside day1, and name it default. mobTalker_script/Friendly/Days/day1/default.txt # Now insert some simple code. #SET_NAME Andr ... #END This will be the text which will be repeated once a love#.script file executes the #FINISH_DAY command. Important: Don't include the #MAKESHADOW command, as it should only be used in the Normal.script file. # Create a folder inside Days, named default. # Create a new UTF-8 text file inside default, and name it default. mobTalker_script/Friendly/Days/default/default.txt # Now insert some simple code. #SET_NAME Andr ... #END This will be the text which will be repeated once the script is over. Time to test if you've completed Step 2 of this guide correctly. # Rename all .txt files to .script. # Open Minecraft. # Talk to the mob your script is made for. If the script runs the way it's supposed to - as described through this guide - you've done everything correct, and can continue on to Step 3. Step 3 Next up, you'll be adding in 1-3 options to choose from during a conversation. To do so, you'll need to understand the basics of how to setup and use the #CONDITION command, so go ahead and read that before continuing. In a nutshell, the setup which #CONDITION uses is as such: "OptionNL" - N = Number, L = Letter If you have three options to choose from, the names will then be "Option1A", "Option1B", and "Option1C". This is important to keep in mind, as the mod determines which script file to run next, based on the name of the option. Ex: If Option1A is chosen, then the mod will load up the file Option1A.script next, etc. Observation: The love level carries on from a love#.script file, into a OptionNL.script file, and vice versa, making it possible to create several paths to the story. When you've become familiar with the setup of this command, try use it, and test the script the same way you've done previously. If it works, then you can continue on to testing out some of the other commands as well. That sums up the basics you need to know in order to code your own scripts. For further instructions on the different commands, as well as a list of them all, please read the Script Commands article. And as mentioned earlier, if you have any further questions or issues with script creating, please let us know, and we'll try and help best possible. References * Script Commands * How to make your own script for mob talker 9.1 Beta Category:Help Category:Scripts